package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tanhua.dubbo.mappers.SoulQuestionMapper;
import com.tanhua.model.domain.SoulQuestion;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class SoulQuestionApiImpl implements SoulQuestionApi {

    @Autowired
    private SoulQuestionMapper soulQuestionMapper;

    @Override
    public List<SoulQuestion> findByQuestionnaireId(Integer questionnaireId) {
        LambdaQueryWrapper<SoulQuestion> lqw = new LambdaQueryWrapper();
        lqw.eq(SoulQuestion::getQuestionnaireId, questionnaireId);
        return soulQuestionMapper.selectList(lqw);
    }

    @Override
    public SoulQuestion findById(Integer questionId) {
        return soulQuestionMapper.selectById(questionId);
    }
}
